'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1539219972448_7118';

  // add your config here
  config.middleware = ['errorHandler'];

  config.security = {
    csrf: {
      enable: false,
    },
    domainWhiteList: ['http://127.0.0.1:8019'],
  };

  config.mongoose = {
    url: 'mongodb://egg:eggAdmin@127.0.0.1:27018/egg_card',
    options: {
      autoReconnect: true,
      reconnectTries: Number.MAX_VALUE,
      bufferMaxEntries: 0,
      useNewUrlParser: true
    }
  };

  // config.sequelize = {
  //   dialect: 'mysql',
  //   database: 'epic_base',
  //   host: '127.0.0.1',
  //   port: '3306',
  //   username: 'epic',
  //   password: 'epicAdmin',
  //   operatorsAliases: false,
  //   define: {
  //     freezeTableName: true,
  //     underscored: true
  //   }
  // }

  config.jwt = {
    secret: 'Great5-ZZJ-uncle',
    enable: true,
    match: '/access/*'
  };

  config.bcrypt = {
    saltRounds: 10
  };

  config.logger = {
    level: 'DEBUG',
    consoleLevel: 'DEBUG'
  };

  return config;
};
